import os

from flask_migrate import MigrateCommand
from flask_script import Manager
from App import create_app

env = os.environ.get("FLASK_ENV", "product")  # 获取服务器环境变量，以便改变运行状态启动调试模式
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
print(BASE_DIR)
app = create_app(env)
manager = Manager(app)
manager.add_command('db', MigrateCommand)  # migrate 对象添加指令

if __name__ == "__main__":
    manager.run()
